package com.zwj.batch.core.batch.job;

import com.zwj.batch.core.batch.step.BatchStep;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * Job 业务处理类
 *
 * @author 张文接
 * @version 1.0
 * @createTime 2024/3/6 16:51
 */
@Component
public class BatchJob {
    /**
     * job 构建工厂
     */
    @Resource
    private JobBuilderFactory jobBuilderFactory;
    /**
     * step 实现类
     */
    @Resource
    private BatchStep batchStep;

    /**
     * 构建 test1Job
     *
     * @return Job
     */
    public Job test1Job() {
        return jobBuilderFactory
                .get("test1")
                .start(batchStep.test1Step1())
                .build();
    }
}
